import { defineStore } from 'pinia'
import request from '@/utils/request'
import { ApiRes, GoodsInfo } from '@/types/data'
const useGoodsStore = defineStore('goods', {
  state() {
    return {
      goodsInfo: {} as GoodsInfo
    }
  },
  actions: {
    async getGoodsInfo(id: string) {
      const res = await request.get<ApiRes<GoodsInfo>>('/goods', { params: { id } })
      this.goodsInfo = res.data.result
    }
  },
  getters: {}
})

export default useGoodsStore
